package com.mall.service.authority.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mall.commons.common.CommonResult;
import com.mall.model.domain.UmsMemberLevel;
import com.mall.service.authority.service.UmsMemberLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/memberLevel")
public class UmsMemberLevelController {

    @Autowired
    private UmsMemberLevelService umsMemberLevelService;

    /**
     * 查询所有会员等级
     * @param defaultStatus
     * @return
     */
    @GetMapping("/list")
    public CommonResult list(Integer defaultStatus){
        LambdaQueryWrapper<UmsMemberLevel> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UmsMemberLevel::getDefaultStatus,defaultStatus);
        List<UmsMemberLevel> list = umsMemberLevelService.list(queryWrapper);
        return CommonResult.success(list);
    }
}
